package com.jdk21.core.utils;

import lombok.extern.slf4j.Slf4j;

import  jakarta.servlet.http.HttpServletRequest;
import java.io.BufferedReader;

@Slf4j
public class HttpRequestUtil {

    public static String getRequestBody(HttpServletRequest httpServletRequest) throws Exception {
        BufferedReader bufferedReader = httpServletRequest.getReader();
        String line;
        StringBuilder stringBuilder = new StringBuilder();
        while ((line = bufferedReader.readLine()) != null) {
            stringBuilder.append(line);
        }
        return stringBuilder.toString();
    }
}
